package live.ifox.toolbox;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.List;
import java.util.Map;

import live.ifox.factory.ContextInfo;
import live.ifox.factory.EnvironmentInfo;
import live.ifox.factory.SystemInfo;
import live.ifox.helper.AdapterHelper;

public class SystemInfoActivity extends BaseActivity {
    ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_system_info);
        actionBar.setTitle(R.string.system_info);

        listView = findViewById(R.id.listView);
    }

    public void onSystemInfo(View v) {
        SystemInfo info = new SystemInfo();
        List<Map<String, Object>> infoModel = info.getModel();

        SimpleAdapter adapter = AdapterHelper.getTableAdapter(this, infoModel,
                new String[]{"label", "detail"});
        listView.setAdapter(adapter);
    }

    public void onEnvironmentInfo(View v) {
        EnvironmentInfo info = new EnvironmentInfo();
        List<Map<String, Object>> infoModel = info.getModel();

        SimpleAdapter adapter = AdapterHelper.getTableAdapter(this, infoModel,
                new String[]{"label", "detail"});
        listView.setAdapter(adapter);
    }

    public void onContextInfo(View v) {
        ContextInfo info = new ContextInfo(this);
        List<Map<String, Object>> infoModel = info.getModel();

        SimpleAdapter adapter = AdapterHelper.getTableAdapter(this, infoModel,
                new String[]{"label", "detail"});
        listView.setAdapter(adapter);
    }
}
